<template>
	<view>
		<div class="glBody">
			<div>
				<div class="ground-lun">
					<view class="uni-padding-wrap">
						<view class="page-section swiper">
							<view class="page-section-spacing">
								<swiper class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay"
									:interval="interval" :duration="duration">
									<!-- 	<swiper-item>
										<view class="swiper-item uni-bg-red"><image src="../../static/image/1.jpg"></image></view>
									</swiper-item> -->
									<swiper-item>
										<view class="swiper-item uni-bg-green">
											<image src="../../static/image/2.png"></image>
										</view>
									</swiper-item>
									<swiper-item>
										<view class="swiper-item uni-bg-blue">
											<image src="../../static/image/3.png"></image>
										</view>
									</swiper-item>
								</swiper>
							</view>
						</view>
					</view>
				</div>
			</div>
		</div>
		<!-- CRM -->
		<div class="glBody showone" ref="piediv" id="popo">
			<view :class="['modoels', serClass]">
				<div class="float-dom">
					<text class="title-one">CRM</text>
					<text class="title-tow">日常办公</text>
				</div>
			</view>
			<div :class="floatClass" v-if="modular.length > 0">
				<fontlist :titles="titlaes[2]" @rundata="rundata" :rows="modular"></fontlist>
			</div>
		</div> 
		<!-- 日常办公 -->
		<div v-if="list_type">
			
		<div v-if="office_lists.length > 0 ">
			<div>
				<fontlist :titles="titlaes[4]" @rundata="rundata" :rows="office_lists"></fontlist>
			</div>	
		</div>


		<!-- 生产制造 -->
		<div v-if="produce_list.length > 0">
			<div>
				<fontlist :titles="titlaes[5]" @rundata="rundata" :rows="produce_list"></fontlist>
			</div>
		</div>

		<!-- 采购管理 -->
	
		<div v-if="purchase_list.length > 0">
			<div>
				<fontlist :titles="titlaes[6]" @rundata="rundata" :rows="purchase_list"></fontlist>
			</div>
		</div>

		<!-- 销售管理 -->

		<div v-if="sale_list.length > 0">
			<div>
				<fontlist :titles="titlaes[8]" @rundata="rundata" :rows="sale_list"></fontlist>
			</div>
		</div>

			<!-- 库存管理 -->
		
			<div v-if="library_list.length > 0">
				<div>
					<fontlistlave :titles="titlaes[7]" @rundata="rundata" :rows="library_list"></fontlistlave>
				</div>
			</div>
		
		</div>
		<!-- 系统管理 -->
		<div >
			<div v-if="authority_list.length > 0">
				<fontlist :titles="titlaes[3]" @rundata="rundata" :rows="system_list"></fontlist>
			</div>
		</div>

		<!-- 下载进度条 -->
		<popus ref="download" :maskClick='false'>
			<div class="Download_progress">
				<div class="dow_title">更新中。。。</div>
				<div class="download_box">
					<div class="dow_to" :style="'width:' + dow_tos + '%'">{{dow_tos}}%</div>
				</div>
			</div>
		</popus>

		<popus ref="alert">
			<alertcenter @row="row" :dataSorc="datasorces" :titles="titl"></alertcenter>
		</popus>
	</view>
</template>

<script>
	import fontlist from '@/components/common/index/fonlist'
	import fontlistlave from '@/components/common/index/fonlist_lave.vue'
	import popus from '@/uni_modules/uni-popup/components/uni-popup/uni-popups'
	import alertcenter from '@/pages/common/common/alert/searalert'
	import {
		getNewestApp,
		http_url
	} from '@/common/api/job/commit.js'
	import {
		list,
		pages,
		city,
		detail,
		activ,
		pageList,
		getUserInfo,
		Searchdetail,
		ForSelect
	} from '@/common/api/job/jobapi.js'
	import {
		sysInfo
	} from '@/common/api/system/system.js'
	export default {
		components: {
			fontlist,
			popus,
			alertcenter,
			fontlistlave
		},
		data() {
			return {
				background: ['color1', 'color2', 'color3'],
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,
				piediv: '',
				serClass: '',
				floatClass: '',
				list_type: true,
				popupShow: true,
				library_list: [ // 库存
					{
						title: '采购出入库',
						lass_list: [{
								name: '采购入库单',
								power: 'purchaseIn:list',
								icon: 'icon-ruku',
								sord: 1,
								msg: 'stock',
								code: "PurchaseReceiveVoucher",
								sort: 0,
								c_code: 1,
								search_code: 'PurchaseReceiveVoucher_List_Report'
							},
							{
								name: '采购退货单',
								power: 'purchaseReturn:list',
								icon: 'icon-caigoutuihuodan',
								sord: 1,
								msg: 'stock',
								code: "PurchaseReceiveVoucher",
								sort: "99",
								c_code: 2,
								search_code: 'PurchaseReceiveVoucher_List_Report'
							},
						]
					},
					{
						title: '销售出入库',
						lass_list: [{
								name: '发货通知单',
								power: 'saleDeliveryWarehouse:list',
								icon: 'icon-tubiaozhizuomoban-143',
								sord: 4,
								msg: 'stock',
								code: "SaleDelivery",
								sort: '0',
								c_code: 0,
								search_code: 'SaleDelivery_List_Report'
							},
							{
								name: '销售出库单',
								power: 'saleOut:list',
								icon: 'icon-xiaoshouchuku',
								sord: 4,
								msg: 'stock',
								code: "SaleDispatchVoucher",
								sort: '0',
								c_code: 2,
								search_code: 'SaleDispatchVoucher_List_Report'
							},
							{
								name: '退货通知单',
								power: 'billSaleReturn:list',
								icon: 'icon-navicon-cgdhd',
								sord: 4,
								msg: 'stock',
								code: "SaleDelivery",
								sort: "98",
								c_code: 1,
								search_code: 'SaleDelivery_List_Report'
							},
							{
								name: '销售退货单',
								power: 'billSaleOutRet:list',
								icon: 'icon-caigoutuihuodan',
								sord: 4,
								msg: 'stock',
								code: "SaleDispatchVoucher",
								sort: '98',
								c_code: 1,
								search_code: 'SaleDelivery_List_Report'
							}
						]
					},
					{
						title: '生产出入库',
						lass_list: [{
								name: '领(退)料申请',
								power: 'picking:list',
								icon: 'icon-tubiaozhizuomoban-143',
								sord: 2,
								msg: 'stock',
								code: "RRS",
								sort: '',
								c_code: 0,
								search_code: 'RRS_List_Report'
							}, // 单独处理
							{
								name: '领料出库',
								power: 'materialOut:list',
								icon: 'icon-yuancailiaochuku',
								sord: 2,
								msg: 'stock',
								code: "MaterialDispatchVoucher",
								sort: "0",
								c_code: 2,
								search_code: 'MaterialDispatchVoucher_List_Report',
								typeMenu: 4
							},
							{
								name: '生产退料',
								power: 'materialOut:list',
								icon: 'icon-yuancailiaochuku',
								sord: 2,
								msg: 'stock',
								code: "MaterialDispatchVoucher",
								sort: '5',
								c_code: 1,
								search_code: 'MaterialDispatchVoucher_List_Report',
								typeMenu: 5
							},
							{
								name: '产品入库',
								power: 'productIn:list',
								icon: 'icon-chanpinruku',
								sord: 2,
								msg: 'stock',
								code: "ProductReceiveVoucher",
								sort: '0',
								c_code: 1,
								search_code: "ProductReceiveVoucher_List_Report"
							},
							{
								name: '产品退库',
								power: 'productIn:list',
								icon: 'icon-chanpinruku',
								sord: 2,
								msg: 'stock',
								code: "ProductReceiveVoucher",
								sort: '94',
								c_code: 2,
								search_code: "ProductReceiveVoucher_List_Report"
							},
						]
					},
					{
						title: '委外出入库',
						lass_list: [{
								name: '委外领(退)料申请',
								power: 'delegatePicking:list',
								icon: 'icon-weiwaibeiliaoyufaliao',
								sord: 3,
								msg: 'stock',
								code: "DelegateRRS",
								sort: '',
								c_code: 0,
								search_code: 'DelegateRRS_List_Report'
							},
							{
								name: '委外领料',
								power: 'delegateOut:list',
								icon: 'icon-chukudan',
								sord: 3,
								msg: 'stock',
								code: "DelegateDispatchVoucher",
								sort: "0",
								c_code: 2,
								search_code: 'DelegateDispatchVoucher_List_Report'
							},
							{
								name: '委外退料',
								power: 'delegateOut:list',
								icon: 'icon-chukudan',
								sord: 3,
								msg: 'stock',
								code: "DelegateDispatchVoucher",
								sort: '5',
								c_code: 1,
								search_code: 'DelegateDispatchVoucher_List_Report'
							},
							{
								name: '委外产品入库',
								power: 'delegateIn:list',
								icon: 'icon-caigouruku',
								sord: 3,
								msg: 'stock',
								code: "DelegateReceiveVoucher",
								sort: '0',
								c_code: 1,
								search_code: 'DelegateReceiveVoucher_List_Report'
							},
							{
								name: '委外产品退库',
								power: 'delegateIn:list',
								icon: 'icon-caigouruku',
								sord: 3,
								msg: 'stock',
								code: "DelegateReceiveVoucher",
								sort: '95',
								c_code: 2,
								search_code: 'DelegateReceiveVoucher_List_Report'
							},
						]
					},
					{
						title: '其他出入库',
						lass_list: [{
								name: '其他入库单',
								power: 'otherIn:list',
								icon: 'icon-weiwaidaohuo',
								sord: 5,
								msg: 'stock',
								code: "OtherReceiveVoucher",
								sort: '',
								c_code: 1,
								search_code: 'OtherReceiveVoucher_List_Report'
							},
							{
								name: '其他出库单',
								power: 'otherOut:list',
								icon: 'icon-qitachuku',
								sord: 5,
								msg: 'stock',
								code: "OtherDispatchVoucher",
								sort: '',
								c_code: 2,
								search_code: 'OtherDispatchVoucher_List_Report'
							},
						]
					},
					{
						title: '盘存业务',
						lass_list: [{
								name: '盘点作业',
								power: 'InventoryWork:list',
								icon: 'icon-weiwaidaohuo',
								msg: 'Inventory',
								code: 0,
								sord: 6,
								search_code: ''
							},
							{
								name: '盘点盈亏表',
								power: 'InventoryProfitAndLoss:list',
								icon: 'icon-qitachuku',
								msg: 'Inventory',
								code: 1,
								sord: 6,
								search_code: ''
							},
						]
					},
					{
						title: '报表分析',
						lass_list: [{
								name: '现存量查询',
								power: 'InventoryQuery:list',
								icon: 'icon-weiwaidaohuo',
								msg: 'analysis',
								code: 0,
								search_code: ''
							},
							{
								name: '出入库流水表',
								power: 'InventoryInoutRunning:list',
								icon: 'icon-qitachuku',
								msg: 'analysis',
								code: 1,
								search_code: ''
							},
							{
								name: '出入库汇总表',
								power: 'InventoryInoutSummariz:list',
								icon: 'icon-qitachuku',
								msg: 'analysis',
								code: 2,
								search_code: ''
							},
							{
								name: '收发存汇总表',
								power: 'InventorySendingReceiving:list',
								icon: 'icon-qitachuku',
								msg: 'analysis',
								code: 3,
								search_code: ''
							},
							{
								name: '库存台账',
								power: 'InventoryBook:list',
								icon: 'icon-qitachuku',
								msg: 'analysis',
								code: 4,
								search_code: ''
							},
						]
					}
				],

				purchase_list: [ // 采购管理
					{
						name: '请购单',
						icon: 'icon-tubiaozhizuomoban-143',
						sord: 1,
						power: 'ProcurementR',
						msg: 'purchase',
						code: "PurchaseRequisition",
						sort: 0
					},
					{
						name: '采购订单',
						icon: 'icon-dingdan',
						sord: 1,
						power: 'ProcurementOrder:list',
						msg: 'purchase',
						code: "PurchaseOrder",
						sort: 0
					},
					{
						name: '拒收通知单',
						icon: 'icon-navicon-dhjsd',
						sord: 1,
						power: 'ProcurementReturn:list',
						msg: 'purchase',
						code: "PuArrival",
						sort: 97
					},
					{
						name: '到货通知单',
						icon: 'icon-navicon-cgdhd',
						sord: 1,
						power: 'ProcurementReceipt:list',
						msg: 'purchase',
						code: "PuArrival",
						sort: 0
					},
					{
						name: '采购入库单',
						icon: 'icon-ruku',
						sord: 1,
						power: 'ProcurementPurch:list',
						msg: 'purchase',
						code: "PurchaseReceiveVoucher",
						sort: 0
					},
					{
						name: '采购退货单',
						icon: 'icon-navicon-dhthd',
						sord: 1,
						power: 'purchaseExami:list',
						msg: 'purchase',
						code: "PurchaseReceiveVoucher",
						sort: 99
					},
					{
						name: '采购发票',
						icon: 'icon-fapiaoguanli',
						sord: 1,
						power: 'ProcurementInvoice:lsit',
						msg: 'purchase',
						code: "PurchaseInvoice",
						sort: 0
					},
					{
						name: '报表分析',
						icon: 'icon-fapiaoguanli',
						sord: 1,
						power: 'RouteView:list',
						msg: 'purchase'
					},
				],
				produce_list: [ // 生产制造
					{
						name: '工序汇报',
						icon: 'icon-huibao',
						sord: 1,
						power: 'manufacture',
						msg: 'produce'
					},
				],
				modular: [], // 客户列表
				system_list: [ // 系统管理
					{
						name: '产品',
						icon: 'icon-ren',
						sord: 1,
						msg: 'system'
					},
				],
				office_list: [ // 办公列表
					{
						name: '工作计划',
						icon: 'icon-jihua',
						msg: 'office',
						power: 'workPlan:list',
						index: 1
					},
					{
						name: '工作总结',
						icon: 'icon-gongzuozongjie',
						msg: 'office',
						power: 'workSummary:list',
						index: 2
					},
					{
						name: '工作报表',
						icon: 'icon-baobiao1',
						msg: 'office',
						power: 'workReportForm:list',
						index: 3
					},
					{
						name: '审核中心',
						icon: 'icon-shenhe',
						msg: 'office',
						power: 'crm:approval',
						index: 4
					},
					{
						name: '审批流程',
						icon: 'icon-liucheng',
						msg: 'office',
						power: 'ApprovalProcess:list',
						index: 5
					},
				],
				sale_list: [ // 销售列表
					{
						name: '报价单',
						icon: 'icon-baojiadan',
						msg: 'sale',
						index: 1,
						power: 'saleQuotation:list',
						code: "SaleQuotation",
						sort: 0
					},
					{
						name: '销售订单',
						icon: 'icon-jihua',
						msg: 'sale',
						index: 1,
						power: 'saleOrder:list',
						code: "SaleOrder",
						sort: 0
					},
					{
						name: '发货通知单',
						icon: 'icon-fahuotongzhi',
						msg: 'sale',
						index: 1,
						power: 'saleDelivery:lsit',
						code: "SaleDelivery",
						sort: 0
					},
					{
						name: '退货通知单',
						icon: 'icon-tuihuo',
						msg: 'sale',
						index: 1,
						power: 'saleReturn:lsit',
						code: "SaleDelivery",
						sort: "96,98",
						c_code: 0
					},
					{
						name: '销售出库单',
						icon: 'icon-chukudan',
						msg: 'sale',
						index: 1,
						power: 'saleOut:list',
						code: "SaleDispatchVoucher",
						sort: 0
					},
					{
						name: '销售退货单',
						icon: 'icon-caigoutuihuodan',
						msg: 'sale',
						index: 1,
						power: 'saleOutRet:list',
						code: "SaleDispatchVoucher",
						sort: '98'
					},
					{
						name: '销售发票',
						icon: 'icon-fapiaoguanli',
						msg: 'sale',
						index: 1,
						power: 'saleInvoice:lsit',
						code: "SaleInvoice",
						sort: ''
					}
				],
				hclass: '',
				titlaes: [ // 模块列表
					'常用应用',
					'营销拓客',
					'客户管理',
					'系统管理',
					'日常办公',
					'生产制造',
					'采购管理',
					'库存管理',
					'销售管理',
				],
				top: '',
				domtop: '',
				dow_tos: '',
				datasorces: '',
				titl: '客户列表',
				power_list: [], //权限列表
				office_lists: [],
				authority_list: [],
			}
		},
		onLoad() {
			if (uni.getStorageSync('Refresh_list') !== 1) {
				uni.navigateBack();
				uni.setStorageSync('Refresh_list', 1);
			}
				// uni.getSystemInfoSync();
					
					// uni.getSystemInfoSync({ 
					// 			success: res => {
					// 				console.log(res.windowHeight);
					// 			}
					// 		}); 
						
		},
		mounted() {

			this.po_authority();

			this.sysUserInfo();

			this.alert_data();

			this.update();
			
		},

		methods: {

			alert_data() {
				let psotData = {
					page: {
						current: 1,
						size: 500
					},
					crmTypes: [0,1],
					companyType:"isCustomer"
				};
				ForSelect(psotData).then((row) => {
					if (row.code == 200) {
						this.datasorces = row.data.records;
						this.datasorces.forEach((item) => {
							this.$set(item, 'name', item.title);
						})
					}
				})
			},

			// 外勤签到处理
			row(val) {
				let calss_id = '';
				let t_title = '';
				detail({
					id: val.key
				}).then((rows) => {
					if (rows.code == 200) {
						if (rows.data.crmType == 0) {
							calss_id = 2;
							t_title = '公海线索';
						} else if (rows.data.crmType == 1) {
							calss_id = 3;
							t_title = '潜在客户';
						} else if (rows.data.crmType == 2) {
							calss_id = 1;
							t_title = '成交客户';
						}
						uni.navigateTo({
							url: '/pages/common/index/recordadd?id=' + rows.data.id + '&crmType=' + rows
								.data.crmType + '&classid=' + calss_id + '&name=' + t_title + '&index=' +
								2 + '&names=' + rows.data.crmName + '&stal=1'
						})
						this.$refs.alert.close();
					}
				})
			},

			// 下载进度
			download_p() {
				this.$refs.download.open('center')
			},

			// 获取是否选择产品级权限列表
			sysUserInfo() {
				this.list_type = false;
				sysInfo().then((rows) => {
					if (rows.code == 200) {
						this.data_handle(rows.data.permissions);
						// 日常办公
						this.office_lists = this.office_list.filter(item => rows.data.permissions.indexOf(item.power) > -1);
						// 生产自造
						this.produce_list = this.produce_list.filter(item => rows.data.permissions.indexOf(item.power) > -1);
						// 采购管理
						this.purchase_list = this.purchase_list.filter(item => rows.data.permissions.indexOf(item.power) > -1);
						// 销售管理
						this.sale_list = this.sale_list.filter(item => rows.data.permissions.indexOf(item.power) > -1);
						
						// 系统管理
						this.authority_list = this.authority_list.filter(item => rows.data.permissions.indexOf(item.power) > -1);
						
						this.$nextTick(function(){
							this.list_type = true;
						})
						if(rows.data.id == 1){
							this.authority_list = [{name:11}];
						}else{
							if (!rows.data.goodsId ) {
								uni.navigateTo({
									url: '/pages/common/system/system'
								})
							}
						}
						
					}
				})
			},

			// 获取有权限采单
			po_authority() {
				getUserInfo().then((rows) => {
					if (rows.code == 200) {
						let sop = [{
								name: '潜在客户',
								index: 3,
								icon: 'icon-ren',
								crmType: 1,
								code: 'crm:potential',
								sord: 1,
								msg: 'customer'
							},
							{
								name: '成交客户',
								index: 1,
								icon: 'icon-kehu',
								crmType: 2,
								code: 'crm:deals',
								sord: 2,
								msg: 'customer'
							},
							{
								name: '公海线索',
								index: 2,
								icon: 'icon-gonghaikehu',
								crmType: 0,
								code: 'crm:clue',
								sord: 3,
								msg: 'customer'
							},
							{
								name: '商机管理',
								index: 4,
								icon: 'icon-shangjiguanli',
								crmType: 5,
								code: 'crm:business',
								sord: 4,
								msg: 'customer'
							},
							{
								name: '市场活动',
								index: 5,
								icon: 'icon-huodong',
								code: 'crm:activity',
								sord: 5,
								msg: 'customer'
							},
							{
								name: '联系人',
								index: 7,
								icon: 'icon-lianxiren',
								crmType: 3,
								code: 'crm:linkMan',
								sord: 6,
								msg: 'customer'
							},
							{
								name: '跟进记录',
								index: 6,
								icon: 'icon-jilu',
								crmType: 4,
								code: 'crm:touch',
								sord: 7,
								msg: 'customer'
							},
							{
								name: '外勤签到',
								index: 8,
								icon: 'icon-xiugai',
								code: 'crm:touch',
								sord: 8,
								msg: 'customer'
							},
						];
						let dataRun = rows.data.permissions;
						for (let i in dataRun) {
							for (let j in sop) {
								if (dataRun[i] == sop[j].code) {
									this.modular.push(sop[j])
								}
							}
						}

						function sordata(a, b) {
							return a.sord - b.sord;
						}
						this.modular.sort(sordata)
					}
				})

			},

			// 统一跳转
			rundata(val, data) {
				if (data.name == '外勤签到') {
					this.$refs.alert.open('bottom');
				} else {
					if (data.msg == 'system') { // 系统管理
						uni.reLaunch({
							url: '/pages/common/system/system'
						})
					}
					if (data.msg == 'customer') { // 客户列表跳转
						uni.navigateTo({
							url: '/pages/common/index/second?id=' + data.index + '&name=' + data.name +
								'&crmType=' + data.crmType
						})
					}
					if (data.msg == 'office') { // 办公
						uni.navigateTo({
							url: '/pages/common/index/office/officelist?key=' + data.index + '&title=' + data.name
						})
					}
					if (data.msg == 'produce') { // 生产制造
						uni.navigateTo({
							// url: '/components/index-modules/Manufacturing/processCard'
							url: '/components/index-modules/Manufacturing/detailed'
						})
					}
					if (data.msg == 'purchase') { //采购管理
						uni.navigateTo({
							url: '/pages/common/index/procure/common?title=' + data.name + "&sort=" + data.sort +
								"&code=" + data.code 
						})
					}
					if (data.msg == 'sale') { //销售管理
						uni.navigateTo({
							url: '/pages/common/index/sale/common?title=' + data.name + "&sort=" + data.sort +
								"&code=" + data.code 
						})
					}
					if (data.msg == 'stock') { // 采购列表页面
						uni.navigateTo({
							url: '/pages/common/index/purchase/common?title=' + data.name + "&sort=" + data.sort +
								"&code=" + data.code + "&key=" + data.msg + '&c_code=' + data.c_code +
								'&search_code=' + data.search_code + '&typeMenu=' + data.typeMenu
						})
					}
					if (data.msg == 'Inventory') { //  盘存
						uni.navigateTo({
							url: '/pages/common/index/purchase/inventory/common?tak=' + 1 + "&code=" + data.code +
								'&msg=' + data.msg + "&title=" + data.name + '&search_code=' + data.search_code +
								'&typeMenu=' + data.typeMenu
						})
					}
					if (data.msg == 'analysis') { // 报表分析
						uni.navigateTo({
							url: '/pages/common/index/purchase/analysis/common?tak=' + 1 + "&code=" + data.code +
								'&msg=' + data.msg + "&title=" + data.name + '&search_code=' + data.search_code +
								'&typeMenu=' + data.typeMenu
						})
					}
				}
			},

			// 更新app
			update() {
				let ban_muber = '';
				let uplode_url = '';
				let edition = '';
				let _this = this;
				// 判断手机类型
				if (uni.getSystemInfoSync().platform = 'android') {
					edition = 1;
				}
				if (uni.getSystemInfoSync().platform = 'ios') {
					edition = 2;
				}
				// 获取当前app版本
				//#ifdef APP-PLUS
				plus.runtime.getProperty(plus.runtime.appid, function(inf) {
					// 获取新版本app
					getNewestApp({
						type: 1
					}).then((rows) => {
						if (rows.code == 200) {
							if (rows.data.appVersion !== inf.version && rows.data.status == 1) {
								// this.doUpData(rows.data.downloadUrl);
								uni.showModal({
									title: '提示',
									content: '发现新版本，是否立即更新',
									success: function(res) {
										if (res.confirm == true) {
											// uni.showLoading({
											// 	title: '更新中……'
											// })
											const downloadTask = uni.downloadFile({ //执行下载
												url: rows.data.downloadUrl, //下载地址 
												success: downloadResult => { //下载成功
													uni.hideLoading();
													if (downloadResult
														.statusCode == 200) {
														uni.showModal({
															title: '',
															content: '下载完成？',
															confirmText: '重启',
															confirmColor: '#EE8F57',
															success: function(
																res) {
																if (res
																	.confirm ==
																	true
																) {
																	plus.runtime
																		.install( //安装
																			downloadResult
																			.tempFilePath, {
																				force: true
																			},
																			function(
																				res
																			) {
																				utils
																					.showToast(
																						'更新成功，重启中'
																					);
																				plus.runtime
																					.restart();
																			}
																		);
																}
															}
														});
													}
												}
											});
											downloadTask.onProgressUpdate((res) => {
												console.log('下载进度' + res.progress);
												console.log('已经下载的数据长度' + res
													.totalBytesWritten);
												console.log('预期需要下载的数据总长度' + res
													.totalBytesExpectedToWrite);
												_this.dow_tos = res.progress;
												_this.$refs.download.open('center');
												// 测试条件，取消下载任务。
												// if (res.progress > 50) {
												//     downloadTask.abort();
												// } 
											});
										} else {

										}
									}
								})
							}
						}
					})
				})

				//#endif

			},

			// 权限管理(库存)
			data_handle(data) {
				let _this = this;
				let toa = '';
				let code_data = [];
				this.library_list.forEach(item => {
					item.lass_list = item.lass_list.filter(rst => data.indexOf(rst.power) > -1)
					
				})
				this.library_list = this.library_list.filter(item => item.lass_list.length > 0)
			},
		}
	}
</script>

<style scoped lang="scss">
	@import "@/static/css/index/index";

	.float-dom-fixed {
		position: fixed;
		background-color: #fff;
		top: 38rpx;
		padding-top: 20rpx;
	}

	.float-dom-height {
		width: 750rpx;
		height: 100%;
		background-color: #fff;
		padding-top: 110rpx;
		padding-bottom: 20rpx;
		margin-bottom: 20rpx;
		border-bottom-right-radius: 8px;
		border-bottom-left-radius: 8px;
	}

	.Download_progress {
		width: 80%;
		margin: auto;
		height: 70px;
		background-color: #fff;

		.download_box {
			width: 70%;
			margin: auto;
			height: 30rpx;
			border: 1px solid #2283E4;

			.dow_to {
				height: 30rpx;
				background-image: linear-gradient(to bottom, #2283E4, #fff, #2283E4);
				text-align: right;
				font-size: 12px;
				line-height: 30rpx;
			}
		}

		.dow_title {
			padding: 10px 0 10px 0;
			text-align: center;
			color: #2283E4;
		}
	}
</style>
